﻿using Agile.Service.Admin.Model.ViewModel.Content;

namespace Agile.Service.Admin.WebApi.Controllers;

/// <summary>
/// 广告服务接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class ContentAdvController : AgileControllerBase
{
    /// <summary> 添加广告 </summary> 
    [HttpPost]
    public async Task<ResponseResult<bool>> Insert(InsertContentAdvRequest request)
    => Result(await this.GetService<IContentAdvService>().InsertAsync(request));

    /// <summary> 修改广告 </summary> 
    [HttpPost]
    public async Task<ResponseResult<bool>> Update(UpdateContentAdvRequest request)
    => Result(await this.GetService<IContentAdvService>().UpdateAsync(request));

    /// <summary> 删除广告 </summary> 
    [HttpGet]
    public async Task<ResponseResult<bool>> Remove(long advID)
    => Result(await this.GetService<IContentAdvService>().RemoveAsync(advID));

    /// <summary> 查询广告 </summary> 
    [HttpPost]
    public async Task<ResponseResult<PageModel<QueryPageContentAdvResponse>>> QueryPage(QueryPageContentAdvRequest request)
    => Result(await this.GetService<IContentAdvService>().QueryPageAsync(request));
}
